<template>
  <div class="tree">
    <div class="first" v-for="item in dataList" :key="item[bindId]">
      <el-tag closable>{{ item[bindValue] }}</el-tag>
      <i class="el-icon-caret-right"></i>
      <template v-if="item.children">
        <tree :dataList="item.children" bindValue="authName"></tree>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  name: 'tree',
  props: {
    dataList: {
      type: Array,
    },
    bindValue: {
      type: String,
      default: 'authName',
    },
    bindId: {
      type: String,
      default: 'id',
    },
  },
}
</script>

<style lang="less" scoped>
div.tree {
  // display: flex;
  display: inline-block;
  // flex-direction: column;
  // justify-content: space-evenly;
  // height: 100%;
position: relative;
  width: 30%;
  line-height: 100%;
  div.first {
    // flex-shrink: 1;
    // position: relative;
    // left: 50%;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    width: 60%;
    padding-left: 120px;
    // border-bottom: 1px solid #ccc;
    height: 40px;
  }
}
</style>
